package com.ruoyi.binance.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.binance.mapper.BinanceAverageBuySellMapper;
import com.ruoyi.binance.domain.BinanceAverageBuySell;
import com.ruoyi.binance.service.IBinanceAverageBuySellService;

/**
 * 均价买卖Service业务层处理
 * 
 * @author zq
 * @date 2025-08-15
 */
@Service
public class BinanceAverageBuySellServiceImpl implements IBinanceAverageBuySellService 
{
    @Autowired
    private BinanceAverageBuySellMapper binanceAverageBuySellMapper;

    /**
     * 查询均价买卖
     * 
     * @param code 均价买卖主键
     * @return 均价买卖
     */
    @Override
    public BinanceAverageBuySell selectBinanceAverageBuySellByCode(String code)
    {
        return binanceAverageBuySellMapper.selectBinanceAverageBuySellByCode(code);
    }

    /**
     * 查询均价买卖列表
     * 
     * @param binanceAverageBuySell 均价买卖
     * @return 均价买卖
     */
    @Override
    public List<BinanceAverageBuySell> selectBinanceAverageBuySellList(BinanceAverageBuySell binanceAverageBuySell)
    {
        return binanceAverageBuySellMapper.selectBinanceAverageBuySellList(binanceAverageBuySell);
    }

    /**
     * 新增均价买卖
     * 
     * @param binanceAverageBuySell 均价买卖
     * @return 结果
     */
    @Override
    public int insertBinanceAverageBuySell(BinanceAverageBuySell binanceAverageBuySell)
    {
        binanceAverageBuySell.setCreateTime(DateUtils.getNowDate());
        return binanceAverageBuySellMapper.insertBinanceAverageBuySell(binanceAverageBuySell);
    }

    /**
     * 修改均价买卖
     * 
     * @param binanceAverageBuySell 均价买卖
     * @return 结果
     */
    @Override
    public int updateBinanceAverageBuySell(BinanceAverageBuySell binanceAverageBuySell)
    {
        binanceAverageBuySell.setUpdateTime(DateUtils.getNowDate());
        return binanceAverageBuySellMapper.updateBinanceAverageBuySell(binanceAverageBuySell);
    }

    /**
     * 批量删除均价买卖
     * 
     * @param codes 需要删除的均价买卖主键
     * @return 结果
     */
    @Override
    public int deleteBinanceAverageBuySellByCodes(String[] codes)
    {
        return binanceAverageBuySellMapper.deleteBinanceAverageBuySellByCodes(codes);
    }

    /**
     * 删除均价买卖信息
     * 
     * @param code 均价买卖主键
     * @return 结果
     */
    @Override
    public int deleteBinanceAverageBuySellByCode(String code)
    {
        return binanceAverageBuySellMapper.deleteBinanceAverageBuySellByCode(code);
    }
}
